define hostgroup {
        hostgroup_name  CheckSwap
        alias           Swap-Is-Low
        members         {% for host in groups['all'] %}{% if hostvars[host].nagios_Check_Services['swap'] == true and hostvars[host].nagios_Check_Services['ping'] == true %}{{host}}{% if not loop.last %},{% endif %} {% endif %} {% endfor %}

}
